package cn.stronglink.asset.message.mq.consumer;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.apache.activemq.command.ActiveMQTextMessage;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;

import cn.stronglink.asset.model.Alarm;

@Component("alarmReceiver")
public class AlarmReceiver implements MessageListener {

	@Override
	public void onMessage(Message message) {    
		try {
			if (!(message instanceof ActiveMQTextMessage)) {
				return;
			}
			TextMessage tm = (TextMessage) message;
			String msg = tm.getText();
			//报警数据
			Alarm alarm = JSON.parseObject(msg, Alarm.class);
			
			//插入报警表
			
			//推送到3D显示
			
			
		} catch (JMSException e) {
			e.printStackTrace();
		}

	}
}
